﻿using System;
using GeneticAlgorithms.Genomes;

namespace GeneticAlgorithms.Operators.Fitness
{
    internal class FitnessLambdaWrapper<TGenome, TGene> : IFitnessProvider<TGenome, TGene> where TGenome : IGenome<TGene>
    {
        public FitnessLambdaWrapper(Func<TGenome, double> calculateFitness)
        {
            this.calculateFitness = calculateFitness;
        }

        private Func<TGenome, double> calculateFitness;

        #region IFitnessProvider<TGene> Members

        public double CalculateFitness(TGenome genome)
        {
            return calculateFitness(genome);
        }

        #endregion
    }
}
